package com.wyzz.hr.action;

import java.util.Map;
import org.apache.axis.utils.StringUtils;
import org.hibernate.criterion.DetachedCriteria;

import com.wyzz.hr.base.wf.leaverequest.LrWfApproverAction;
import com.wyzz.hr.bo.ILeaverequestBO;
import com.wyzz.hr.pojo.Leaverequest;
import com.wyzz.hr.util.Pager;
import com.wyzz.hr.vo.ExaminSearchBean;
import com.wyzz.hr.vo.LeaveFormBean;

public class AllLeaveSearchAction extends LrWfApproverAction {

	public AllLeaveSearchAction() {
	}

	public String execute() throws Exception {
		isXiaojia = "";
		srcAction = "allLeaveSearch";
		initLRLists();
		if (page == null) {
			page = new Pager();
			page.setOrder("");
		}
		if (es_Bean == null)
			es_Bean = new ExaminSearchBean();
		setLeaveType((String) dbConfigManager.getProperties().get(
				"sys.examin.leave.type"));
		ILeaverequestBO lr_BO = (ILeaverequestBO) getBean("leaverequestBO");
		DetachedCriteria dc = DetachedCriteria.forClass(Leaverequest.class);
		if ("SUB".equals(super.authorityCondition))
			addSubDC(dc, "emp", 4);
		lr_BO.examinSearch(es_Bean, dc, page);
		if (!StringUtils.isEmpty(infoMeg))
			addSuccessInfo(infoMeg);
		return "success";
	}

	public String hrConfirmWithModify() throws Exception {
		if (lf_Bean == null)
			return "error";
		String auth = checkActionAuth("allLeaveSearch", "execute");
		if (!"HR".equals(auth)) {
			addErrorInfo("\u60A8\u65E0\u6743\u6267\u884C\u6B64\u64CD\u4F5C\uFF01");
			return "noauth";
		} else {
			return wfObjOpSingle("hr-confirm", lf_Bean, lrUpdateId);
		}
	}

	/**
	 * @deprecated Method validate is deprecated
	 */

	public void validate() {
		validateDate(es_Bean);
		validateLRStatus(es_Bean);
	}

	public ExaminSearchBean getEs_Bean() {
		return es_Bean;
	}

	public void setEs_Bean(ExaminSearchBean es_Bean) {
		this.es_Bean = es_Bean;
	}

	public Pager getPage() {
		return page;
	}

	public void setPage(Pager page) {
		this.page = page;
	}

	public String getSrcAction() {
		return srcAction;
	}

	public void setSrcAction(String srcAction) {
		this.srcAction = srcAction;
	}

	public String getIsXiaojia() {
		return isXiaojia;
	}

	public void setIsXiaojia(String isXiaojia) {
		this.isXiaojia = isXiaojia;
	}

	public String getApproveOper() {
		return approveOper;
	}

	public void setApproveOper(String approveOper) {
		this.approveOper = approveOper;
	}

	public String getEndAPM() {
		return endAPM;
	}

	public void setEndAPM(String endAPM) {
		this.endAPM = endAPM;
	}

	public LeaveFormBean getLf_Bean() {
		return lf_Bean;
	}

	public void setLf_Bean(LeaveFormBean lf_Bean) {
		this.lf_Bean = lf_Bean;
	}

	public String getLrUpdateId() {
		return lrUpdateId;
	}

	public void setLrUpdateId(String lrUpdateId) {
		this.lrUpdateId = lrUpdateId;
	}

	public String getStartAPM() {
		return startAPM;
	}

	public void setStartAPM(String startAPM) {
		this.startAPM = startAPM;
	}

	private static final long serialVersionUID = 1L;
	private ExaminSearchBean es_Bean;
	private Pager page;
	private String srcAction;
	private String isXiaojia;
	private String infoMeg;
	private String approveOper;
	private LeaveFormBean lf_Bean;
	private String lrUpdateId;
	private String startAPM;
	private String endAPM;
}
